WhatsApp Template APIs
The WhatsApp Template APIs allow businesses to create and manage pre-approved WhatsApp message templates. These templates are required to send outbound WhatsApp messages and support dynamic parameters, media headers, and interactive buttons.
Before using the WhatsApp Template APIs, ensure the following:
-
WhatsApp Business Account
Your business must be onboarded for WhatsApp messaging through Msgkart. -
Business ID
A valid Msgkart Business ID is required. -
API Key
An active API key provided by Msgkart.
This must be passed in request headers asx-api-key. -
Template Approval
All templates must be approved by WhatsApp before they can be used.
Create WhatsApp Template
This API allows you to create a WhatsApp message template under your business account. Once approved, the template can be used to send WhatsApp messages to end users.
Request Syntax
POST /api/v1/template/{{BUSINESS ID}}
Request headers
"x-api-key": "<API KEY>"
Interactive Template – Without Image & Without Variables
Request Body
{
"name": "{{templateName}}",
"language": "{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "BODY",
"text": "{{bodyText}}"
}
]
}
Interactive Template – Without Image & With Variables
Request Body
{
"name": "{{templateName}}",
"language": "{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}",
"{{example2}}"
]
]
}
}
]
}
Interactive Template – With Image & With Variables
Request Syntax
POST /api/v1/template/media/{{BUSINESS ID}}
Request headers
"x-api-key": "<API KEY>"
Request Body
{
"name": "{{templateName}}",
"language":"{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [
]
}
},
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}",
"{{example2}}"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "{{buttonText}}"
},
{
"type": "PHONE_NUMBER",
"text": "{{buttonText}}",
"phone_number": "{{phoneNumber}}"
},
{
"type": "URL",
"text": "{{buttonText}}",
"url": "{{url}}"
}
]
}
],
}
Image (Binary Format)
- Image must be sent as binary file, not as a URL
- Use the form-data key files to upload the image
- Leave
header_handleempty in the JSON payload
Carousel Template
Request Syntax
POST /api/v1/template/media/{{BUSINESS ID}}
Request headers
"x-api-key": "<API KEY>"
Request Body
{
"name": "{{templateName}}",
"language":"{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}",
"{{example2}}"
]
]
}
},
{
"type": "CAROUSEL",
"cards": [
{
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [
]
}
},
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "URL",
"text": "{{buttonText}}",
"url": "{{url}}",
"example": [
"{{example1}}"
]
}
]
}
]
},
{
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [
]
}
},
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "URL",
"text": "{{buttonText}}",
"url": "{{url}}",
"example": [
"{{example1}}"
]
}
]
}
]
}
]
}
],
}
Image (Binary Format)
- Image must be sent as binary file, not as a URL
- Use the form-data key files to upload the image
- Leave
header_handleempty in the JSON payload
Response Body
{
"id": "{{templateId}}",
"status": "{{templateStatus}}",
"category": "{{templateCategory}}"
}
Properties
| Field | Description | Example |
|---|---|---|
x-api-key | API key for authentication (request header) | {{apiKey}} |
name | Unique WhatsApp template name | {{templateName}} |
language | Template language code | {{templateLanguage}} |
category | WhatsApp template category | {{templateCategory}} |
components | Message structure (BODY, HEADER, BUTTONS, etc.) | — |